/**
 * Course Project for User Interface Programming I, 2011
 * Group 19
 */
package justdoit.actions;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import justdoit.Startup;
import justdoit.model.Task;
import justdoit.view.EditTaskDialog;
import justdoit.controller.LanguageManager;
/**
 * 
 * @author Can
 */
public class NextTaskAction extends AbstractAction {

    private EditTaskDialog etd;

    public NextTaskAction(EditTaskDialog etd) {
        super(LanguageManager.getString("button.next"));
        this.etd = etd;
    }

    public NextTaskAction(String text) {
        super(text);
    }

    public NextTaskAction(String text, ImageIcon icon) {
        super(text, icon);
    }

    public NextTaskAction(String text, ImageIcon icon,
            String desc, Integer mnemonic) {
        super(text, icon);
        putValue(SHORT_DESCRIPTION, desc);
        putValue(MNEMONIC_KEY, mnemonic);
    }

    public void actionPerformed(ActionEvent e) {
        Task nextTask = Startup.getMainFrame().getTaskListPanel().getNextTask();
        if (nextTask != null) {
            etd.update(nextTask);
        }
    }
}
